﻿
<%@ page import="com.claims.Claim" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title>Edit Claim</title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${resource(dir:'')}"><g:message code="menu.home" /></a></span>
            <span class="menuButton"><g:link class="list" action="list">Claim List</g:link></span>
            <span class="menuButton"><g:link class="create" action="create">New Claim</g:link></span>
        </div>
        <div class="body">
            <h1>Edit Claim</h1>
						<jdsb:message />
            <g:hasErrors bean="${claimInstance}">
            <div class="errors">
                <g:renderErrors bean="${claimInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <input type="hidden" name="id" value="${claimInstance?.id}" />
                <input type="hidden" name="version" value="${claimInstance?.version}" />
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="employee">Employee:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:claimInstance,field:'employee','errors')}">
                                    <g:select optionKey="id" from="${com.claims.Employee.list()}" name="employee.id" value="${claimInstance?.employee?.id}" ></g:select>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="date">Date:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:claimInstance,field:'date','errors')}">
                                    <g:datePicker name="date" value="${claimInstance?.date}" precision="minute" ></g:datePicker>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="clinic">Clinic:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:claimInstance,field:'clinic','errors')}">
                                    <g:select optionKey="id" from="${com.claims.Clinic.list()}" name="clinic.id" value="${claimInstance?.clinic?.id}" ></g:select>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="reason">Reason:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:claimInstance,field:'reason','errors')}">
                                    <input type="text" id="reason" name="reason" value="${fieldValue(bean:claimInstance,field:'reason')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="status">Status:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:claimInstance,field:'status','errors')}">
                                    <g:select id="status" name="status" from="${claimInstance.constraints.status.inList}" value="${claimInstance.status}" ></g:select>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="dateSubmitted">Date Submitted:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:claimInstance,field:'dateSubmitted','errors')}">
                                    <g:datePicker name="dateSubmitted" value="${claimInstance?.dateSubmitted}" precision="minute" ></g:datePicker>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="dateVerified">Date Verified:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:claimInstance,field:'dateVerified','errors')}">
                                    <g:datePicker name="dateVerified" value="${claimInstance?.dateVerified}" precision="minute" ></g:datePicker>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="dateApproved">Date Approved:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:claimInstance,field:'dateApproved','errors')}">
                                    <g:datePicker name="dateApproved" value="${claimInstance?.dateApproved}" precision="minute" ></g:datePicker>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="dateRejected">Date Rejected:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:claimInstance,field:'dateRejected','errors')}">
                                    <g:datePicker name="dateRejected" value="${claimInstance?.dateRejected}" precision="minute" ></g:datePicker>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="authorize">Authorize:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:claimInstance,field:'authorize','errors')}">
                                    <g:select optionKey="id" from="${com.claims.Employee.list()}" name="authorize.id" value="${claimInstance?.authorize?.id}" ></g:select>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="dependants">Dependants:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:claimInstance,field:'dependants','errors')}">
                                    <g:select name="dependants"
from="${com.claims.Dependant.list()}"
size="5" multiple="yes" optionKey="id"
value="${claimInstance?.dependants}" />

                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="submissionNo">Submission No:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:claimInstance,field:'submissionNo','errors')}">
                                    <input type="text" id="submissionNo" name="submissionNo" value="${fieldValue(bean:claimInstance,field:'submissionNo')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="totalAmount">Total Amount:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:claimInstance,field:'totalAmount','errors')}">
                                    <input type="text" id="totalAmount" name="totalAmount" value="${fieldValue(bean:claimInstance,field:'totalAmount')}" />
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="type">Type:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:claimInstance,field:'type','errors')}">
                                    <g:select optionKey="id" from="${com.claims.code.Type.list()}" name="type.id" value="${claimInstance?.type?.id}" ></g:select>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="verify">Verify:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:claimInstance,field:'verify','errors')}">
                                    <g:select optionKey="id" from="${com.claims.Employee.list()}" name="verify.id" value="${claimInstance?.verify?.id}" ></g:select>
                                </td>
                            </tr> 
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" value="Update" /></span>
                    <span class="button"><g:actionSubmit class="delete" onclick="return confirm('Are you sure?');" value="Delete" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
